﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
using System.Drawing;

public partial class Supervise_GoodsInfo : System.Web.UI.Page
{
    Int64 GoodsId = -1;
    string strSql;
    public string straa;
    public string strbb;
    //public string choose;
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumSupervise); 
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))//是否为合法用户
        {
            if (!IsPostBack)
            {
                straa = "none";
                strbb = "none";
                HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
 


                this.Title = "修改商品";
                if (HZ.Fun.IsInt(Request.QueryString["id"]))
                {
                    GoodsId = Convert.ToInt64(Request.QueryString["id"]);
                }
                else
                {
                    string _goodsid = MsgBox.JieMi_Decrypt(Request.QueryString["id"].ToString());
                    if (HZ.Fun.IsInt(_goodsid))
                    {
                        GoodsId = Convert.ToInt64(_goodsid);
                    }
                    else
                    {
                        HZ.Web.WebUtil.Alert("没有要添加的商品或页面过期，请重新点击！！");
                        Response.End();
                    }
                }

                Db db = new Db();
                try
                {
                    System.Data.IDataReader dr;
                    strSql = "select GoodsByCompany.*,ca.CompanyName,cb.CompanyName as companyName_Agent from GoodsByCompany inner join Company ca on GoodsByCompany.AccountId_SC=ca.AccountId left join Company cb on GoodsByCompany.AccountId_Agent=cb.AccountId  where GoodsByCompanyid ='" + GoodsId + "' ";
                    dr = db.DataReader(strSql);
                    while (dr.Read())
                    {
                        txtGoodsId.Value = dr["GoodsByCompanyId"].ToString();
                        rbtnYb.SelectedValue = dr["memo1"].ToString();
                        txtProductNameSM.Text = dr["ProductNameSM"].ToString();
                        labProductName.Text = dr["productname"].ToString();
                        string _strMedicinemodel = dr["medicinemodel"].ToString();
                        string _strOutlookc = dr["outlookc"].ToString();
                        labMedicinemodel.Text = _strMedicinemodel;
                        labOutlookc.Text = _strOutlookc;
                        labUnit.Text = dr["unit"].ToString();
                        txtCompany.Text = dr["companyName"].ToString();
                        txtFactor.Text = dr["xishu"].ToString();
                        txtGoodsInstruction.Text = dr["GoodsInstruction"].ToString();
                        txtGoodsName.Text = dr["goodsname"].ToString();
                        txtImportCode.Text = dr["ImportCode"].ToString();
                        txtImportRegistDate.Text = dr["ImportRegistDate"].ToString();
                        if (SysFun.ToTrim(dr["ImportRegistDate"]) == "1900-1-1 0:00:00")
                        {
                            txtImportRegistDate.Text = "";
                        }
                        txtLicenseNumber.Text = dr["licensenumber"].ToString();
                        txtLicenseNumberDate.Text = dr["licensenumberdate"].ToString();
                        if (SysFun.ToTrim(dr["licensenumberdate"]) == "1900-1-1 0:00:00")
                        {
                            txtLicenseNumberDate.Text = "";
                        }
                        txtMaterial.Text = dr["Material"].ToString();
                        txtPackUnit.Text = dr["PackUnit"].ToString();
                        rdoQualityLevels.SelectedValue = SysFun.ToTrim(dr["QualityLevels"]);
                        if (rdoQualityLevels.SelectedValue == "0") lableshow.Text = "第一质量层次： 专利保护期内的化合物专利药品和药物组合物专利药品；获得国家科技进步奖的药品";
                        if (rdoQualityLevels.SelectedValue == "1") lableshow.Text = "第二质量层次： 发改委公布的单独定价药品和优质优价中成药";
                        if (rdoQualityLevels.SelectedValue == "2") lableshow.Text = "第三质量层次： 专利保护期内的工艺流程发明专利药品（含剂型专利药品）；过保护期的（化合物、药物组合物）专利药品；进口药品；获得美国ＦＤＡ认证或欧盟ＣＥ、ＣＧＭＰ认证的药品；质量标准起草单位的药品（含原研药品和首仿国外药品）";
                        if (rdoQualityLevels.SelectedValue == "3") lableshow.Text = "第四质量层次： 通过GMP认证的其他药品";

                        txtRetailPrice.Text = dr["RetailPrice"].ToString();
                        //labNoPass.Text = dr["nopass"].ToString();

                        if (SysFun.ToTrim(dr["IsImport"]) != "")
                        {
                            chkIsImport.Checked = Convert.ToBoolean(dr["IsImport"].ToString());
                        }
                        else
                        {
                            chkIsImport.Checked = false;
                        }
                        if (chkIsImport.Checked == false)
                        {
                            straa = "none";
                        }
                        else
                        {
                            straa = "block";
                        }

                        if (dr["IsSurveyReport"].ToString() != "")
                        {
                            chkIsSurveyReport.Checked = Convert.ToBoolean(dr["IsSurveyReport"].ToString());
                        }
                        else
                        {
                            chkIsSurveyReport.Checked = false;
                        }
                        if (chkIsSurveyReport.Checked == false)
                        {
                            strbb = "none";
                        }
                        else
                        {
                            strbb = "block";
                            txtSurveyReportDate.Text = dr["SurveyReportDate"].ToString();
                            if (SysFun.ToTrim(dr["SurveyReportDate"]) == "1900-1-1 0:00:00")
                            {
                                txtSurveyReportDate.Text = "";
                            }
                            txtSurveyReportId.Text = dr["SurveyReportId"].ToString();
                        }

                        this.txtjz.Text = dr["jzdate"].ToString();
                        txtIsalerId_dL.Text = dr["AccountId_Agent"].ToString();
                        txtIsSalerId.Value = dr["AccountId_SC"].ToString();
                        txtaccountid_trj.Value = dr["AccountId_TJR"].ToString();
                        txtCompany_dl.Text = dr["companyName_Agent"].ToString();
                        txtMemo4.Text = SysFun.ToTrim(dr["memo4"]);
                        txtMemo5.Text = dr["memo5"].ToString();


                        //查看
                        if (!string.IsNullOrEmpty(Request.QueryString["flag"]))
                        {

                            this.Title = "查看商品";
                            lbltitle.Text = "查看商品";
                           
                            Div1.Visible = false;
                        }
                    }

                    dr.Close();
                    dr.Dispose();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    db.Close();
                }

            }
        }
    }
 

    protected void BtnCancel_Click(object sender, EventArgs e)
    {
        Response.Write("<script>window.close();</script>");
    }

    
    //获取审核不 通过原因
    private string GetNOpss()
    {

        return "";
    }
    
}
